﻿using System;
using System.Collections.Generic;
using System.Domain.Entity;
using System.Domain.IRepository;
using System.Text;
using Application.Infrastructure;
using Domain.Infrastructure;

namespace System.Application
{
    /// <summary>
    /// 用
    /// </summary>
    public class SysRoleAuthorizeService : BaseService_C<SysRoleAuthorizeEntity>
    {
        private readonly ISysRoleAuthorizeRepository _repository;

        public SysRoleAuthorizeService(ILog log, ISysRoleAuthorizeRepository repository) : this(log, repository, "")
        {
        }
        public SysRoleAuthorizeService(ILog log, ISysRoleAuthorizeRepository repository, string userId) : base(log, repository, userId)
        {
            _repository = repository;
        }
        public List<SysRoleAuthorizeEntity> GetList(string roleId)
        {
            try
            {
                return _repository.GetList(roleId);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }

        public List<SysModuleEntity> GetMenuList(string roleId)
        {
            try
            {

                return _repository.GetMenuList(roleId);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }

        public List<SysModuleAuthorizeEntity> GetButtonList(string roleId)
        {
            try
            {
                return _repository.GetButtonList(roleId);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }

        public RoleAuthorizeEntity ActionValidate(string roleId, string url)
        {
            try
            {
                return _repository.ActionValidate(roleId, url);
            }
            catch (Exception ex)
            {
                Log.Error(ex);
                throw;
            }
        }

    }
}
